//
//  DecorateLine.m
//  xpkc
//
//  Created by TopSageMacMini on 14/12/23.
//  Copyright (c) 2014年 wanmeizty. All rights reserved.
//

#import "DecorateLine.h"

@implementation DecorateLine

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if(self) {
        
    }
    return self;
}

- (void)drawRect:(CGRect)rect {
    CGContextRef context = UIGraphicsGetCurrentContext();
    
    NSInteger len = SCREEN_WIDTH / 40;
    
    for(int i=0;i<len;i++) {
        if(i % 2 == 0) {
            CGContextSetRGBStrokeColor(context, 176/255.0, 224/255.0, 250/255.0, 1.0);
            CGContextSetLineWidth(context, 5.0);
            CGPoint aPoint[2];
            aPoint[0] = CGPointMake(40*i, 0);
            aPoint[1] = CGPointMake(20+40*i, 0);
            CGContextAddLines(context, aPoint, 2);
            CGContextDrawPath(context, kCGPathStroke);
            
            CGContextSetRGBStrokeColor(context, 252/255.0, 187/255.0, 188/255.0, 1.0);
            CGContextSetLineWidth(context, 5.0);
            CGPoint bPoint[2];
            bPoint[0] = CGPointMake(40+40*i, 0);
            bPoint[1] = CGPointMake(60+40*i, 0);
            CGContextAddLines(context, bPoint, 2);
            CGContextDrawPath(context, kCGPathStroke);
        } else if(i % 2 == 1){
            
            
            CGContextSetRGBStrokeColor(context, 252/255.0, 187/255.0, 188/255.0, 1.0);
            CGContextSetLineWidth(context, 5.0);
            CGPoint bPoint[2];
            bPoint[0] = CGPointMake(40+40*i, 0);
            bPoint[1] = CGPointMake(60+40*i, 0);
            CGContextAddLines(context, bPoint, 2);
            CGContextDrawPath(context, kCGPathStroke);
            
            CGContextSetRGBStrokeColor(context, 176/255.0, 224/255.0, 250/255.0, 1.0);
            CGContextSetLineWidth(context, 5.0);
            CGPoint aPoint[2];
            aPoint[0] = CGPointMake(20+40*i, 0);
            aPoint[1] = CGPointMake(20+40*i, 0);
            CGContextAddLines(context, aPoint, 2);
            CGContextDrawPath(context, kCGPathStroke);
        }
    }
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
